<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        console.log('na'.repeat(2.3));  // "nana"
        console.log('na'.repeat(2.9));  // "nana"
        // console.log('na'.repeat(Infinity)); 报错
        // console.log('na'.repeat(-1)); 报错
        console.log('na'.repeat(-0.9));  // ""
        console.log('na'.repeat(NaN));  // ""
        console.log('na'.repeat('na'));  // ""
        console.log('na'.repeat('3'));  // "nanana"
    </script>
</body>
</html>